import { getSite, getGoodsOrder } from "@/api/index";
const state = {
  //用户的地址信息
  userSite: [],
  //订单信息
  orderInfo: {},
};
const mutations = {
  //设置用户的弟子信息
  setUserSite(state, data) {
    state.userSite = data;
  },
  //设置订单的信心
  setOrderInfo(state, data) {
    state.orderInfo = data;
  },
};
const actions = {
  //获取用户地址信息
  async getUserSite({ commit }) {
    const res = await getSite();
    if (res.code == 200) {
      commit("setUserSite", res.data);
    }
  },
  //获取商品氢弹的数据
  async getOrderInfo({ commit }) {
    const res = await getGoodsOrder();
    if (res.code == 200) {
      commit("setOrderInfo", res.data);
    }
  },
};
const getters = {};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
